<?php
error_reporting(0);
session_start();
include_once '../comm/config.php';
include_once 'page.class.php';
include_once '../comm/checkpostandget.php';
include_once '../comm/wjt.php';
include_once 'check.php';

$page = !($_GET['page'])?'1':intval($_GET['page']);
$pagesize=10;
$page2=($page-1)*$pagesize;
$txxz=TXXZ;
if($txxz=='TXXZ'){$txxz=0;}
$hlink = mysql_connect($dbserver, $dbuser, $dbpass);
if (!$hlink) {
	die(ERR_DB);
}
else
{
	mysql_query("set names utf8");
	mysql_select_db($dbname);
	$sql="select * from ".$BIAOTOU."user where Id=".$_SESSION['dduserid']; 
	$rs = mysql_query($sql);
	while ($row = mysql_fetch_array($rs))
	{
		$zfb=$row["zfb"]; 
		$realname=$row["tbusername"];
		$money=$row["money"];
		$mobile=$row["mobile"];
		$txstate=$row["txstate"];
		if($txstate=='1'){
			echo "<script language=javascript>window.location='error.php?id=12';</script>";
			exit;
		}
	}
}
mysql_close($hlink);
$tag="center";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>申请提现 - 用户中心</title>
<link href="../css/usercss.css" rel="stylesheet" type="text/css">
<link href="../template/<?=MOBAN?>/css/common.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/jquery.js"></script>
<script language="javascript" type="text/javascript">
function checktxje()
{
		var str1 = parseFloat(document.getElementById("txje").value); 
		var str2 = parseFloat(document.getElementById("ktx").value);    
        if(str1.length!=0)
		{     
			if(str1>str2)
			{    
				document.getElementById("cktxje").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>金额不能大于可提现金额</font>';
				return false;
			}
			else
			{
				<?php
				if($txxz!='0'){
				?>
				if(str1%<?=$txxz?>!=0){
					document.getElementById("cktxje").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>金额只能是<?=$txxz?>或<?=$txxz?>的倍数</font>';
					return false;
				}else{
					document.getElementById("cktxje").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>提现金额正确</font>';
					return true;
				}
				<?php
				}else{
				?>
					document.getElementById("cktxje").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>提现金额正确</font>';
					return true;
				<?php }?>
			}
		}
		else
		{
				document.getElementById("cktxje").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写提现金额</font>';
				return false;
		}
}   
function checkzfb1()
{
		var str = document.getElementById("zfb1").value;    
        if(str.length==0)
		{    
			document.getElementById("ckzfb1").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写支付宝</font>';
			return false;
		}
		else
		{
			document.getElementById("ckzfb1").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>支付宝填写正确</font>';
			return true;		
		}
}
		
function checkzfb2()
{
		var str1 = document.getElementById("zfb1").value;
		var str2 = document.getElementById("zfb2").value;    
        if(str2.length!=0)
		{    
			if(str1!=str2)
			{    
				document.getElementById("ckzfb2").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>两次支付宝填写不一样，请检查</font>';
				return false;
			}
			else
			{
				document.getElementById("ckzfb2").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>支付宝确认正确</font>';
				return true;
			}
		}
		else
		{
				document.getElementById("ckzfb2").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写支付宝</font>';
				return false;
		}
} 
function checkpass()
{
	var password = document.getElementById("password").value;    
    	if(password.length==0)
		{
			document.getElementById("ckpassword").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请输入密码</font>';
			return false;
		}
		else
		{
			document.getElementById("ckpassword").innerHTML = '';
			return true;
		}
}
function checkall()
{
	if(!checktxje()||!checkzfb1()||!checkzfb2()||!checkpass())
	{
		return false;
	}
	else
	{
		return true;
	}
}
</script>
</head>

<body id="usercenter">
<?php
include("../template/".MOBAN."/header.tpl.php");
?>
<?php
include("../template/".MOBAN."/nav.tpl.php");
?>
<div id="main">
<?php
include("left.php");
?>
<DIV class=contain>
<H2 class=left_nav1>申请提现</H2>
<div class="order">
    <div class="content" style="font-size:12px; height:320px;">
	<form id="form1" name="form1" method="post" action="tixian_save.php" onsubmit="return checkall()">
                        <table width="625" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td height="35" colspan="3"><div style="border:1px solid #FFCC7F; background-color:#FFFFE5; padding:8px;">&nbsp;&nbsp;<b>提示信息：</b><br />
                            &nbsp;&nbsp;&nbsp;&nbsp;在您提出提现申请24小时内，我们将返现金额直接支付到您提供的支付宝账户中，请注意查收！</div></td>
                          </tr>
                          <tr>
                            <td width="136" height="35" align="right">可提现金额：</td>
                            <td height="35" colspan="2" align="left">&nbsp;&nbsp;&nbsp;<b class="biggreentext"><?php echo $money?></b>&nbsp;&nbsp;元
                            <input type="hidden" name="ktx" id="ktx" value="<?php echo $money?>" /></td>
                          </tr>
                          <tr>
                            <td height="35" align="right">申请提现：</td>
                            <td height="35" align="left">&nbsp;&nbsp;
                                <input name="txje" id="txje" type="text" size="15" maxlength="10" value="<?php if($txxz!='0'){echo floor($money/$txxz)*$txxz;}else{echo $money;}?>" onblur="checktxje();" style="width:100px"/> <font color="#FF0000">*</font>
                            &nbsp;&nbsp;元</td>
                            <td height="35" align="left" id="cktxje">请填写，金额小于<font class="biggreentext"><?php echo $money?></font>元<?PHP if($txxz!='0'){?>且须是<font class="biggreentext"><?=$txxz?></font>的倍数<?php }?></td>
                          </tr>
                          <tr>
                            <td height="35" align="right">支付宝账号：</td>
                            <td width="231" height="35" align="left">&nbsp;&nbsp;
                            <input type="text" name="zfb1" id="zfb1" onblur="checkzfb1();" value="<?php echo $zfb?>" <?php if ($zfb!=""){ echo "readonly";}?> style="width:200px"/> <font color="#FF0000">*</font></td>
                            <td width="258" height="35" align="left" id="ckzfb1">请正确填写支付宝账号，填写后不可修改</td>
                          </tr>
                          <tr>
                            <td height="35" align="right">确认支付宝账号：</td>
                            <td height="35" align="left">&nbsp;&nbsp;
                            <input type="text" name="zfb2" id="zfb2"onblur="checkzfb2();" value="<?php echo $zfb?>" <?php if ($zfb!=""){ echo "readonly";}?> style="width:200px" /> <font color="#FF0000">*</font></td>
                            <td height="35" align="left" id="ckzfb2">请再次确认支付宝账号，填写后不可修改</td>
                          </tr>
                          <tr>
                            <td height="35" align="right">收款人姓名：</td>
                            <td height="35" align="left">&nbsp;&nbsp;
							<input name="realname" id="realname" type="text" value="<?php echo $realname?>" <?php if ($realname!=""){ echo "readonly";}?> style="width:200px" /></td>
                            <td height="35" align="left">转账核对时用，填写后不可修改(与支付宝对应)</td>
                          </tr>
						   <tr>
                            <td height="35" align="right">手机号：</td>
                            <td height="35" align="left">&nbsp;&nbsp;
							<input name="mobile" id="mobile" type="text" value="<?php echo $mobile?>" style="width:200px"/></td>
                            <td height="35" align="left">填写后，提现成功，会免费短信通知您</td>
                          </tr>
                          <tr>
                            <td height="35" align="right">本站登录密码：</td>
                            <td height="35" align="left">&nbsp;&nbsp;
							<input name="password" id="password" type="password" onblur="checkpass();"  style="width:200px"/> <font color="#FF0000">*</font></td>
                            <td height="35" align="left" id="ckpassword">本站登录密码，校对用，必须填写</td>
                          </tr>
                          <tr>
                            <td height="35" align="right">&nbsp;</td>
                            <td height="35" colspan="2" align="left">&nbsp;&nbsp;
							<input type="submit" name="Submit" value="申请提现" class="smtgray" /></td>
                          </tr>
      </table>
        </form>
	</div>
	</div>
</div>
</div>
<?php
include("../template/".MOBAN."/footer.tpl.php");
?>
</body>
</html>